package com.hrt.datasender.web.bcdevicemonitorparam;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;

import com.btcode.web.core.annotation.RequestMapping;
import com.btcode.web.core.controller.Controller;
import com.hrt.common.web.DSRequestUnit;
import com.hrt.datasender.datadao.model.BcDeviceMonitorParamModel;
import com.hrt.datasender.datadao.service.BcDeviceMonitorParamService;

/**
 * 驱动
 * 
 * @author gislin
 *
 */
@RequestMapping(path = "BcDeviceMonitorParam")
public class BcDeviceMonitorParamController extends Controller {

    @RequestMapping(path = "create")
    public void create(ServletRequest arg0, ServletResponse arg1) throws IOException {

        BcDeviceMonitorParamModel model = DSRequestUnit.getModel(BcDeviceMonitorParamModel.class);
        BcDeviceMonitorParamService.getInstance().create(model);
        success("");
    }

    @RequestMapping(path = "update")
    public void update(ServletRequest arg0, ServletResponse arg1) throws IOException {

        BcDeviceMonitorParamModel model = DSRequestUnit.getModel(BcDeviceMonitorParamModel.class);
        BcDeviceMonitorParamService.getInstance().update(model);
        success("");
    }

    @RequestMapping(path = "delete")
    public void delete(ServletRequest arg0, ServletResponse arg1) throws IOException {

        BcDeviceMonitorParamModel model = DSRequestUnit.getModel(BcDeviceMonitorParamModel.class);
        BcDeviceMonitorParamService.getInstance().delete(model);
        success("");
    }

    @RequestMapping(path = "getListByDevice")
    public void getListByDevice(ServletRequest arg0, ServletResponse arg1) throws IOException {

        String deviceId = DSRequestUnit.getString("deviceID");

        List<BcDeviceMonitorParamModel> models = BcDeviceMonitorParamService.getInstance().getListByDeviceID(deviceId);
        success(models);
    }

    @RequestMapping(path = "getListByStation")
    public void getListByStation(ServletRequest arg0, ServletResponse arg1) throws IOException {

        List<BcDeviceMonitorParamModel> models = BcDeviceMonitorParamService.getInstance().getParamByStation();
        success(models);
    }
}
